'use strict';

const welfareModel=require("./models/welfare.js");

exports.main = async (event, context) => {
	//event为客户端上传的参数
	uniCloud.logger.info('event : ', event);

	let res = {};

	switch (event.action) {
		case 'queryTaps':
			const queryTapsRes=await welfareModel.queryTaps();
			uniCloud.logger.info('queryTapsRes : ', queryTapsRes);
			res=queryTapsRes.data;
			break;
		case 'queryCoupons':
			const queryCouponsRes=await welfareModel.queryCoupons();
			res=queryCouponsRes.data;
			break;
		default:
			console.log("api未定义");
			break;
	}

	//返回数据给客户端
	return res;
};
